#ifndef CLUSNET_NET_UDPDATAPACKET_H
#define CLUSNET_NET_UDPDATAPACKET_H

#include <clusnet/base/DynamicBuffer.h>

namespace clusnet
{
namespace net
{

class UdpDataPacket final
{
    public:
        UdpDataPacket();
        UdpDataPacket(size_t dataLength);
        ~UdpDataPacket();
        UdpDataPacket(UdpDataPacket const&) = delete;
        UdpDataPacket& operator= (UdpDataPacket const&) = delete;
        UdpDataPacket(UdpDataPacket&&);
        UdpDataPacket& operator= (UdpDataPacket&&);

    public:
        char const* cdata() const { return data_.cbegin(); }
        char* data() { return data_.begin(); }
        void append(char const*, size_t);
        static constexpr size_t maxLength() { return MAX_LENGTH_; }
        size_t dataLength() const { return data_.length(); }

    private:
        clusnet::base::DynamicBuffer    data_;

        static constexpr size_t     MAX_LENGTH_ = 65535;
};
}
}

#endif
